<%@ page contentType="text/html;charset=utf-8"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>untitled</title>
  </head>
  <body>
    <P>LA CADENA DE CONSULTA ES:</P>
    <P>&nbsp;</P>
    <P>&nbsp;</P>
<%
  String strSQL="SELECT ";
  int totalAtributos=Integer.valueOf(request.getParameter("numAtributos")).intValue();
  int cantAtributos=0;
  for(int i=0;i<totalAtributos;i++){
    String strAtributos=request.getParameter("atributo"+i);
    if(strAtributos != null) 
      cantAtributos++;
  }
  for(int i=0;i<totalAtributos;i++){
    String strAtributos=request.getParameter("atributo"+i);
    if(strAtributos != null){
      if(i<=cantAtributos-1) strSQL+=strAtributos+", ";
      else strSQL+=strAtributos+" ";
    }

  }
  strSQL+="FROM PRUEBA_ATRIBUTOS ";
  String strCondiciones=request.getParameter("condiciones");
  if(!strCondiciones.equals("")) strSQL+="WHERE "+strCondiciones;
  
  out.println(strSQL);

%>
  </body>
</html>
